﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Wangzeran.CodeMaker.GUI.Utils
{
    /// <summary>
    /// 消息框工具
    /// </summary>
    public class MessageHelper
    {
        /// <summary>
        /// 显示消息框
        /// </summary>
        /// <param name="title">消息框标题</param>
        /// <param name="message">消息框文本</param>
        /// <returns></returns>
        public static DialogResult ShowInfomation(string title, string message)
        {
            try
            {
                return MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {	
                throw ex;
            }
        }

        /// <summary>
        /// 显示警告对话框
        /// </summary>
        /// <param name="title">消息框标题</param>
        /// <param name="message">消息框文本</param>
        /// <returns></returns>
        public static DialogResult ShowWarning(string title, string message)
        {
            try
            {
                return MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {	
                throw ex;
            }
        }

        /// <summary>
        /// 显示错误对话框
        /// </summary>
        /// <param name="title">消息框标题</param>
        /// <param name="message">消息框文本</param>
        /// <returns></returns>
        public static DialogResult ShowError(string title, string message)
        {
            try
            {
                return MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {	
                throw ex;
            }
        }


        /// <summary>
        /// 显示询问对话框框
        /// </summary>
        /// <param name="title">消息框标题</param>
        /// <param name="message">消息框文本</param>
        /// <returns></returns>
        public static DialogResult ShowQuestion(string title, string message)
        {
            try
            {
                return MessageBox.Show(message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            }
            catch (Exception ex)
            {	
                throw ex;
            }
        }

    }
}
